home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  2.7 KB  |  134 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __TIMER__
  18. #define __TIMER__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __OSUTILS__
  27. #include <OSUtils.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if GENERATINGPOWERPC
  36. #pragma options align=mac68k
  37. #endif
  38.  
  39. #ifdef __CFM68K__
  40. #pragma lib_export on
  41. #endif
  42.  
  43.  
  44. enum {
  45. /* high bit of qType is set if task is active */
  46.     kTMTaskActive                = (1L << 15)
  47. };
  48.  
  49. typedef struct TMTask TMTask, *TMTaskPtr;
  50.  
  51. /*
  52.         TimerProcPtr uses register based parameters on the 68k and cannot
  53.         be written in or called from a high-level language without the help of
  54.         mixed mode or assembly glue.
  55.  
  56.         In:
  57.          => tmTaskPtr       A1.L
  58. */
  59.  
  60. #if GENERATINGCFM
  61. typedef UniversalProcPtr TimerUPP;
  62. #else
  63. typedef Register68kProcPtr TimerUPP;
  64. #endif
  65.  
  66. struct TMTask {
  67.     QElemPtr                        qLink;
  68.     short                            qType;
  69.     TimerUPP                        tmAddr;
  70.     long                            tmCount;
  71.     long                            tmWakeUp;
  72.     long                            tmReserved;
  73. };
  74.  
  75. #if !GENERATINGCFM
  76. #pragma parameter InsTime(__A0)
  77. #endif
  78. extern pascal void InsTime(QElemPtr tmTaskPtr)
  79.  ONEWORDINLINE(0xA058);
  80.  
  81. #if !GENERATINGCFM
  82. #pragma parameter InsXTime(__A0)
  83. #endif
  84. extern pascal void InsXTime(QElemPtr tmTaskPtr)
  85.  ONEWORDINLINE(0xA458);
  86.  
  87. #if !GENERATINGCFM
  88. #pragma parameter PrimeTime(__A0, __D0)
  89. #endif
  90. extern pascal void PrimeTime(QElemPtr tmTaskPtr, long count)
  91.  ONEWORDINLINE(0xA05A);
  92.  
  93. #if !GENERATINGCFM
  94. #pragma parameter RmvTime(__A0)
  95. #endif
  96. extern pascal void RmvTime(QElemPtr tmTaskPtr)
  97.  ONEWORDINLINE(0xA059);
  98. extern pascal void Microseconds(UnsignedWide *microTickCount)
  99.  FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  100. enum {
  101.     uppTimerProcInfo = kRegisterBased
  102.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA1, SIZE_CODE(sizeof(TMTaskPtr)))
  103. };
  104.  
  105. #if GENERATINGCFM
  106. #define NewTimerProc(userRoutine)        \
  107.         (TimerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  108. #else
  109. #define NewTimerProc(userRoutine)        \
  110.         ((TimerUPP) (userRoutine))
  111. #endif
  112.  
  113. #if GENERATINGCFM
  114. #define CallTimerProc(userRoutine, tmTaskPtr)        \
  115.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTimerProcInfo, (tmTaskPtr))
  116. #else
  117. /* (*TimerProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  118. #endif
  119.  
  120.  
  121. #ifdef __CFM68K__
  122. #pragma lib_export off
  123. #endif
  124.  
  125. #if GENERATINGPOWERPC
  126. #pragma options align=reset
  127. #endif
  128.  
  129. #ifdef __cplusplus
  130. }
  131. #endif
  132.  
  133. #endif /* __TIMER__ */
  134.